<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子45-ES6/7常用语法介绍</title>
    </head>

    <body>
        <pre>
            <code>
                // 例子45

                class Point {
                    constructor(x, y) {
                        this.x = x;
                        this.y = y;
                    }
                }

                class ColorPoint extends Point {
                    constructor(x, y, color) {
                        this.color = color; // Uncaught ReferenceError: Must call super constructor in derived class before accessing 'this' or returning from derived constructor
                        super(x, y);
                        this.color = color; // 正确
                    }
                }
                let p = new ColorPoint(1, 2, 'red');
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/45.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>

</html>